Change in openvpn[master]: mudp: fix handling of multiple UDP socket flags
A message that is not in the archive (sent off-list or not yet received): gerrit.1762862118000.I509ea79990305f39e3385136fc0d9e5fbfa68e6c@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1365?usp=email
to review the following change.
Change subject: mudp: fix handling of multiple UDP socket flags
......................................................................
mudp: fix handling of multiple UDP socket flags
The handler previously used an 'else-if' chain to process only the first matching flag, and then overwrote 'm->multi_io->udp_flags' with a fixed value (e.g. 'ES_ERROR'). This caused remaining event bits to be ignored if multiple flags (such as SOCKET_READ and SOCKET_WRITE) were set simultaneously.
This patch changes the logic to test each flag independently and clear only the bits that were actually handled.
---
M src/openvpn/mudp.c
1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/65/1365/1
src/openvpn/mudp.c +4 -1
@@ -342,6 +342,7 @@const unsigned int mpp_flags = m->top.c2.fast_io ? (MPP_CONDITIONAL_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ) : (MPP_PRE_SELECT |MPP_CLOSE_ON_SIGNAL ); +unsigned int processed_flags =0 ;#ifdef MULTI_DEBUG_EVENT_LOOP char buf[16 ];
@@ -361,6 +362,7 @@if (status &SOCKET_WRITE ) {multi_process_outgoing_link (m, mpp_flags); + processed_flags |=SOCKET_WRITE ; }/* Incoming data on UDP port */ else if (status &SOCKET_READ )
@@ -370,9 +372,10 @@ {multi_process_incoming_link (m,NULL , mpp_flags, sock); } + processed_flags |=SOCKET_READ ; } - m->multi_io->udp_flags =ES_ERROR ; + m->multi_io->udp_flags &= ~processed_flags; }/*
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I509ea79990305f39e3385136fc0d9e5fbfa68e6c
Gerrit-Change-Number: 1365
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: its_Giaan, plaisthos.
flichtenheld has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1365?usp=email )
Change subject: mudp: fix handling of multiple UDP socket flags
......................................................................
Patch Set 3: Code-Review-2
(1 comment)
Patchset:
PS3:
Just documenting the state of this change since many discussions only seem to have happened in IRC:
It is unclear whether this fix is correct.
* If the flags are not cleared but preserved will the code actually handle them later?
* If yes, why not replace the else if with just if and handle them directly?
* If no, this patch does nothing.
So this needs more testing and/or more explanation.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I509ea79990305f39e3385136fc0d9e5fbfa68e6c
Gerrit-Change-Number: 1365
Gerrit-PatchSet: 3
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Comment-Date: Wed, 14 Jan 2026 14:37:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: its_Giaan, plaisthos.
cron2 has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1365?usp=email )
Change subject: mudp: fix handling of multiple UDP socket flags
......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS3:
So, the reason why I have not progressed this is that I wonder if it has any effect at all - from staring at the code, my understanding is that nothing afterwards ever checks udp_flags, so it does not really matter what we put in. That is, the udp_flags part of this change.
Doing both branches at the same time, if both have work to do, might be a good thing.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I509ea79990305f39e3385136fc0d9e5fbfa68e6c
Gerrit-Change-Number: 1365
Gerrit-PatchSet: 3
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Comment-Date: Wed, 14 Jan 2026 14:38:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
its_Giaan has abandoned this change. ( http://gerrit.openvpn.net/c/openvpn/+/1365?usp=email )
Change subject: mudp: fix handling of multiple UDP socket flags
......................................................................
Abandoned
reworking this
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1365?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: abandon
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I509ea79990305f39e3385136fc0d9e5fbfa68e6c
Gerrit-Change-Number: 1365
Gerrit-PatchSet: 3
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>